package com.dbh.design.methodtemplate;

import java.util.ArrayList;
import java.util.List;

/**
 * 合同构造处理
 * @author dongbanghui
 * @create 2023/4/5
 */
public class ContractConstruct {
    List<PostProcessor> postProcessorList = new ArrayList<>();
    public void createContract() {
        Object o = new Object();

        System.out.println("解析数据");
        for (PostProcessor postProcessor : postProcessorList) {
            postProcessor.handler(o);
        }
        System.out.println("合同创建完执行逻辑");
    }

    /**
     * 添加处理器
     * @param postProcessor 处理器对象
     */
    public void addPostProcessor(PostProcessor postProcessor) {
        postProcessorList.add(postProcessor);
    }

}
